<template>
  <div style="padding:20px;height:95%">
    <el-card>
      <h1>铭文列表</h1>
      <el-tabs type="border-card"
               v-model="activeName"
               @tab-click="tabClick">
        <el-tab-pane :label='item.name'
                     v-for="(item,i) in $store.state.inscs"
                     :key="i"
                     :name="item._id">
          <insclist :list='item'></insclist>
        </el-tab-pane>
      </el-tabs>
    </el-card>
  </div>
</template>

<script>
import insclist from '../../components/insclist.vue'
export default {
  components: { insclist },
  data () {
    return {
      activeName: ''
    }
  },
  methods: {
    isActiveName () {
      this.activeName = sessionStorage.getItem('ActivityName') ? sessionStorage.getItem('ActivityName') : JSON.parse(sessionStorage.getItem('Insc'))[0]._id
    },
    tabClick (event) {
      sessionStorage.setItem('ActivityName', event._props.name)
    }
  },
  created () {
    this.isActiveName()
  }
}
</script>
